package com.glhtgyxy.biyesheji.Mapper;

import com.glhtgyxy.biyesheji.Pojo.user;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface userMapper {

    @Select("select * from user")
    ArrayList<user> selectAllUser();
    @Delete("delete from user where id = #{id}")
    int deleteUser(@Param("id") int id);
    @Update("update user set username=#{name} , useraccount=#{account} , userpassword=#{password} where id = #{id}")
    int updateUser(@Param("id") int id,@Param("name") String name,
                   @Param("account") String account,@Param("password") String password);
    @Insert("insert into user (username,useraccount,userpassword) values (#{name},#{account},#{password})")
    int addUser(@Param("name") String name,
                @Param("account") String account,
                @Param("password") String password);
    @Select("SELECT * FROM user WHERE id LIKE CONCAT('%', #{searchtext}, '%') OR username LIKE CONCAT('%', #{searchtext}, '%') OR useraccount LIKE CONCAT('%', #{searchtext}, '%') OR userpassword LIKE CONCAT('%', #{searchtext}, '%')")
    ArrayList<user> findUser4(@Param("searchtext") String searchtext);

}
